package com.hig.questions.mapper;

import java.util.List;
import com.hig.questions.domain.ExamQuestionsBank;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;

/**
 * 题库管理Mapper接口
 * 
 * @author qnsdt
 * @date 2022-12-19
 */
public interface ExamQuestionsBankMapper 
{
    /**
     * 查询题库管理
     * 
     * @param bankCode 题库管理ID
     * @return 题库管理
     */
    public ExamQuestionsBank selectExamQuestionsBankById(String bankCode);
    List<String> selectDistinctBankCode();
    /**
     * 查询题库管理列表
     * 
     * @param examQuestionsBank 题库管理
     * @return 题库管理集合
     */
    public List<ExamQuestionsBank> selectExamQuestionsBankList(ExamQuestionsBank examQuestionsBank);
    public List<ExamQuestionsBank> selectExamQuestionsBankListRel(ExamQuestionsBank examQuestionsBank);

    public List<ExamQuestionsBank> selectExamQuestionsBankListByName(ExamQuestionsBank examQuestionsBank);


    /**
     * 查询题库管理列表
     * 
     * @param examQuestionsBank 题库管理
     * @return 题库管理集合
     */
    public List<ExamQuestionsBank> selectExamQuestionsBankListByCode(String[] bankCodes);

    /**
     * 新增题库管理
     * 
     * @param examQuestionsBank 题库管理
     * @return 结果
     */
//    public int insertExamQuestionsBank(ExamQuestionsBank examQuestionsBank);

    /**
     * 修改题库管理
     * 
     * @param examQuestionsBank 题库管理
     * @return 结果
     */
    public int updateExamQuestionsBank(ExamQuestionsBank examQuestionsBank);

    /**
     * 删除题库管理
     * 
     * @param bankCode 题库管理ID
     * @return 结果
     */
    public int deleteExamQuestionsBankById(String bankCode);

    /**
     * 批量删除题库管理
     * 
     * @param bankCodes 需要删除的数据ID
     * @return 结果
     */
    public int deleteExamQuestionsBankByIds(String[] bankCodes);


    @Select("SELECT IFNULL(MAX(bank_id), 0) + 1 FROM exam_questions_bank")
    Long getNextBankId();

    @Insert("INSERT INTO exam_questions_bank (bank_id, bank_code, bank_name, bank_describe, bank_version, exam_type, online_date, picture_url, radio_score, choice_score, judge_score, status, create_by, create_dept, create_time,marked) VALUES (#{bankId}, #{bankCode}, #{bankName}, #{bankDescribe}, #{bankVersion}, #{examType}, #{onlineDate}, #{pictureUrl}, #{radioScore}, #{choiceScore}, #{judgeScore}, 0, #{createBy}, #{createDept}, now(),#{marked})")
    void insertExamQuestionsBank(ExamQuestionsBank examQuestionsBank);
}
